<?php
Zend_Loader::loadFile('../application/default/models/common.php');
class Form_Hotel extends Zend_Form
{
    public function init()
    {
        Zend_Loader::loadClass('Roomcats', array('../application/admin/models/'));
        Zend_Loader::loadClass('Hotel', array('../application/admin/models/'));
        Zend_Loader::loadClass('Common', array('../application/default/models/'));
        $roomcat = new Roomcats();
        $hotel = new Hotel();
        $common = new Common();
        $roomcat_arr = $roomcat->listroomcats();
        $amenity_arr = $hotel->getAminities();
        $country_arr = $common->getCountries();
        $city_arr = $common->getCities();
        $this->setMethod('post');
        $this->addPrefixPath('Lion_Form_Element', '../library/Form/Element/', 'element');

        $this->addElement('hidden', 'hotel_id', array(

        'filters'	=> array('int'),
        'class'		=> 'hidden',

        ));

        $this->addElement('text', 'hotel_title', array(
        'label'      => 'Hotel Title:',
        'filters'    => array('StringTrim'),
        'class'			 => 'input-2',
        'validators' => array(
        array('validator' => 'StringLength', 'options' => array(0, 50))
        )
        ));

        $hotel_country= new Zend_Form_Element_Select('hotel_country');
        $hotel_country ->setLabel('Hotel Country');
        $hotel_country->setOptions(array('class'=>'input-2'));
        $hotel_country->addMultiOption("", "Select Country");
        foreach ($country_arr as $country_entry) {
            $hotel_country->addMultiOption($country_entry['country_id'], $country_entry['country_name']);
        }
        
        $hotel_country->setAttrib('onChange', 'return getCity();');
        
        $this->addElement($hotel_country);

        $hotel_city= new Zend_Form_Element_Select('hotel_city');
        $hotel_city ->setLabel('Hotel City');
        $hotel_city->setOptions(array('class'=>'input-2'));
        $hotel_city->addMultiOption("", "Select City");
        $this->addElement($hotel_city);
        
        $roomcat = $this->createElement('multiCheckbox', 'room_cat[]');
        $roomcat->setLabel('Room Category:');
        foreach ($roomcat_arr as $roomcat_entry) {
            $roomcat->addMultiOption($roomcat_entry['roomcat_id'], $roomcat_entry['roomcat_type']);
        }
        $this->addElement($roomcat);

       	$newsletter_content = $this ->addElement('formRTE', 'hotel_description',
    				array('label' =>'Hotel Description:',
    					'validators' =>array(
    					array('validator' =>'StringLength', 'options' =>array(0, 1000))
    				),
		));
		
		$this->addElement('text', 'contact_person', array(
        'label'      => 'Contact Person:',
        'filters'    => array('StringTrim'),
        'class'			 => 'input-2',
        'size' => 100,
        'validators' => array(
        array('validator' => 'StringLength', 'options' => array(0, 50))
        )
        ));
        
        $this->addElement('text', 'contact_email', array(
        'label'      => 'Contact Email:',
        'filters'    => array('StringTrim'),
        'class'			 => 'input-2',
        'size' => 100,
        'validators' => array(
        array('validator' => 'StringLength', 'options' => array(0, 50))
        )
        ));

        $this->addElement('text', 'hotel_phone', array(
        'label'      => 'Hotel Phone:',
        'filters'    => array('StringTrim'),
        'class'			 => 'input-2',
        'validators' => array(
        array('validator' => 'StringLength', 'options' => array(0, 100))
        )
        ));

        $this->addElement('text', 'hotel_fax', array(
        'label'      => 'Hotel Fax:',
        'filters'    => array('StringTrim'),
        'class'			 => 'input-2',
        'validators' => array(
        array('validator' => 'StringLength', 'options' => array(0, 100))
        )
        ));

        $this->addElement('text', 'hotel_skype', array(
        'label'      => 'Hotel Skype:',
        'required'   => false,
        'filters'    => array('StringTrim'),
        'class'			 => 'input-2',
        'validators' => array(
        array('validator' => 'StringLength', 'options' => array(0, 100))
        )
        ));

		$this->addElement('text', 'no_of_rooms', array(
        'label'      => 'No. of Rooms:',
        'required'   => false,
        'filters'    => array('StringTrim'),
        'class'			 => 'input-2',
        'validators' => array(
        array('validator' => 'StringLength', 'options' => array(0, 20))
        )
        ));

        
        
        /*$amenity = $this->createElement('multiCheckbox', 'amenities[]');
        $amenity->setLabel('Amenities:');
        foreach ($amenity_arr as $amenity_entry) {
            $amenity->addMultiOption($amenity_entry['amenity_id'], $amenity_entry['amenity_type']);
        }
        $this->addElement($amenity);*/

        $this->addElement('textarea', 'facilities',
        array('label' =>'Facilities:',
        'rows' => 5,
        'cols' => 85
        )
        );

        $this ->addElement('textarea', 'remarks',
        array('label' =>'Remarks:',
        'rows' => 5,
        'cols' => 85
        )
        );

        $this->addElement('checkbox', 'is_enabled', array(
        'label'      => 'Is Enabled:',
        'filters'    => array('int'),

        ));
    }    
}
